<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>利用函数反判断闰年</title>
    <script>
        function isLeapYear(year){
            var flag = false;
            if(year % 4 == 0 && year % 100 != 0 || year % 400 ==0){
                flag = true;
            }
            return flag;
        }
        console.log(isLeapYear(2020) ? '2020是闰年':'2020不是闰年');
        console.log(isLeapYear(2021) ? '2021是闰年':'2021不是闰年');
    </script>
</head>
<body>

</body>
</html>